﻿using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using SX.Core;
using SX.ProductService.API.Base;
using SX.ProductService.Service.Implement.Product.ViewModel;
using SX.ProductService.Service.Interface;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Threading.Tasks;

namespace SX.ProductService.API.Controllers
{
    [Description("产品管理")]
    [Menu]
    public class ProductController : BaseController
    {
        private readonly IProductService _service;
        public ProductController(IProductService productService)
        {
            _service = productService;
        }

        [HttpGet]
        [Description("查询")]
        public Task<IApiResult> Query([FromQuery] ProductQueryModel model)
        {
            return _service.Query(model);
        }

        [HttpPost]
        [Description("新增")]
        public async Task<IApiResult> Add([FromBody] ProductAddModel model)
        {
            return await _service.Add(model);
        }
    }
}
